package com.hspedu.homework.homework13;

/**
 * @Author Stringzhua
 * @Date 2024/3/3 20:00
 * description:Student类
 * 属性:名字name,性别sex,年龄age,学号stu_id
 * 做合理封装,通过构造器在创建对象时,将4个属性赋值
 */
public class Student extends Person {
    //属性
    private String stu_id;
    //方法
    //构造器

    public Student(String name, char gender, int age, String stu_id) {
        super(name, gender, age);
        this.stu_id = stu_id;
    }

    //get/set方法
    public String getStu_id() {
        return stu_id;
    }

    public void setStu_id(String stu_id) {
        this.stu_id = stu_id;
    }

    //学生有一个学习的方法
    public void study() {
        System.out.println(getName() + "承诺,我会好好学习~");
    }

    //重写父类的play
    /*
     * 学生爱玩足球
     * @return
     * */
    @Override
    public String play() {
        return super.play() + "足球";
    }

    //打印方法
    public void printInfo() {
        System.out.println("学生的信息");
        System.out.println(super.basicInfo());
        System.out.println("学号:" + stu_id);
        study();
        System.out.println(play());
    }

    @Override
    public String toString() {
        return "Student{" +
                "stu_id='" + stu_id + '\'' +
                '}' + super.toString();
    }
}
